#include<iostream>
using namespace std;
const int N = 110, mod = 1e6 + 7;
int f[N][N];
int a[N];
int n, m;
int dfs(int u, int sum)
{
	if (sum == m)return 1;
	if (sum > m)return 0;
	if (u == n + 1)return 0;
	if (f[u][sum])return f[u][sum];
	int res = 0;
	for (int i = 0; i <= a[u]; i++) {
		res += dfs(u + 1, sum + i) % mod;
		res %= mod;
	}
	f[u][sum] = res;
	return res;
}
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	cout << dfs(1, 0) << endl;
	return 0;
}